package com.nine.pesys.model.action;

import com.nine.pesys.base.BaseAction;
import com.nine.pesys.model.entity.Game;
import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.convention.annotation.*;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * Created by L先森 on 2014/12/26.
 */
@Controller
@Scope("prototype")
@Namespace("/game")
@ParentPackage(value="my_struts")
@Results({
        @Result(name = "games",location = "/dd")
})
public class GameAction extends BaseAction<Game>  {

    @Action("/allGames")
    public String allGames() throws Exception{
        games = this.gameService.findAll();
        if (games.size()>0)
            ActionContext.getContext().put("games",games);
        return "games";
    }
}
